const path = require('path')
const resolve = d => path.resolve(__dirname, './', d)

module.exports = {
  markdown: {
    lineNumbers: true
  },
  title: 'Golang Tutorial',
  description: 'Golang tutorial documents',
  head: [
    ['link', { rel: 'icon', href: `/favicon.ico` }]
  ],
  themeConfig: {
    navbar: true,
    sidebarDepth: 0,
    sidebar: [
      {
        title: 'Introduction',
        collapsable: false,
        children: [
          ['/introduction/introduction-install', 'Introduction and Installation '],
          ['/introduction/helloworld', 'Hello World']
        ]
      },
      {
        title: 'Variables, Types and Constants',
        collapsable: false,
        children: [
          ['/variable-type-constant/variables', 'Variables '],
          ['/variable-type-constant/types', 'Types '],
          ['/variable-type-constant/constants', 'Constants '],
        ]
      },
      {
        title: 'Functions and Packages',
        collapsable: false,
        children: [
          ['/function-package/functions', 'Functions '],
          ['/function-package/packages', 'Packages '],
        ]
      },
      {
        title: 'Conditional Statements and Loops',
        collapsable: false,
        children:[
          ['/conditional-loop/if-else', 'If Else statement'],
          ['/conditional-loop/loops', 'Loops'],
          ['/conditional-loop/switch', 'Switch statement']
        ]
      },
      {
        title: 'Arrays, Slices and Variadic Functions',
        collapsable: false,
        children: [
          ['/array-slice-variadicfunc/arrays-slices', 'Arrays and Slices'],
          ['/array-slice-variadicfunc/variadic-functions', 'Variadic Functions']
        ]
      },
      {
        title: 'More types',
        collapsable: false,
        children: [
          ['/more-types/maps', 'Maps'],
          ['/more-types/strings', 'Strings']
        ]
      },
      {
        title: 'Pointers, Structures and Methods',
        collapsable: false,
        children: [
          ['/pointers-structures-methods/pointers', 'Pointers'],
          ['/pointers-structures-methods/structures', 'Structures'],
          ['/pointers-structures-methods/methods', 'Methods']
        ]
      },
      {
        title: 'Interfaces',
        collapsable: false,
        children: [
          ['/interfaces/interfaces-1', 'Interfaces - I'],
          ['/interfaces/interfaces-2', 'Interfaces - II']
        ]
      },
      {
        title: 'Concurrency',
        collapsable: false,
        children: [
          ['/concurrency/concurrency-intro', 'Introduction to Concurrency'],
          ['/concurrency/goroutines', 'Goroutines'],
          ['/concurrency/channels', 'Channels'],
          ['/concurrency/bufferedchannels-workerpools', 'Buffered Channels and Worker Pools'],
          ['/concurrency/select', 'Select'],
          ['/concurrency/mutex', 'Mutex']
        ]
      },
      {
        title: 'Object Oriented Programming',
        collapsable: false,
        children: [
          ['/object-oriented-programming/structs-insteadof-classes', 'Structs Instead of Classes'],
          ['/object-oriented-programming/composition-insteadof-inheritance', 'Composition Instead of Inheritance'],
          ['/object-oriented-programming/polymorphism', 'Polymorphism']
        ]
      },
      {
        title: 'Defer and Error Handling',
        collapsable: false,
        children: [
          ['/defer-errorhandling/defer', 'Defer'],
          ['/defer-errorhandling/error-handling', 'Error Handling'],
          ['/defer-errorhandling/custom-errors', 'Custom Errors'],
          ['/defer-errorhandling/panic-recover', 'Panic and Recover']
        ]
      },
      {
        title: 'First Class Functions',
        collapsable: false,
        children: [
          ['/first-class-functions/first-class-functions', 'First Class Functions']
        ]
      },
      {
        title: 'Reflection',
        collapsable: false,
        children: [
          ['/reflection/reflection', 'Reflection']
        ]
      },
      {
        title: 'Filehandling',
        collapsable: false,
        children: [
          ['/filehandling/reading-files', 'Reading Files'],
          ['/filehandling/writing-files', 'Writing Files']
        ]
      }
    ],
  },
  // less: {
  //   // modifyVars: {
  //   //   'primary-color': '#1DA57A',
  //   //   'link-color': '#1DA57A',
  //   // },
  //   javascriptEnabled: true,
  // },
  configureWebpack: {
    resolve: {
      alias: {
        '@static': resolve('static')
      }
    },
  },
  // chainWebpack: (config, isServer) => {
  //   config.module
  //     .rule('js')
  //     .use('babel-loader')
  //     .tap(options => Object.assign(options, { // 更改 options
  //       plugins: [
  //         ["import", {
  //           "libraryName": "ant-design-vue",
  //           "libraryDirectory": "es",
  //           // "style": "css",
  //           "style": true
  //         }]
  //       ]
  //     }))
  // }
}